FloatingClient
@objc(LSFloatingClient)
class FloatingClient : BaseManager
extension FloatingClient : CVarArg, CustomDebugStringConvertible, CustomStringConvertible, Equatable, Hashable, NSObjectProtocol
Entry point to the LicenseSpring SDK Class for performing basic requests to LicenseSpring floating server
-
Init FloatingClient with configuration.
Throws
LSErrorif the configuration is invalid or the client cannot be initialized.Note
In Objective-C, pass an instance conforming to the
LSBaseStorageprotocol forbaseStorage. In Swift, pass an instance conforming toBaseStorage.Declaration
Swift
@objc init(configuration: Configuration, baseStorage: AnyObject? = nil) throwsParameters
configurationConfiguration of FloatingClient.
baseStorageAn optional object used for low-level data storage operations such as reading, writing, and deleting raw license data. Accepts either a Swift implementation conforming to
BaseStorageor an Objective-C object conforming toLSBaseStorage. Ifnil, the default internal file-based storage is used. This parameter is primarily intended for advanced customization of how license files are persisted. -
Activated License or nil if no license is active.
Declaration
Swift
@objc var currentLicense: License? { get } -
Base Storage object passed by the user for custom license storage implementation
Declaration
Swift
let baseStorage: any BaseStorage -
Register client with given id.
Send register license request to the Floating server.
Throws
LSErrorif registration fails.Declaration
Swift
@objc func register(userID: String) throws -> LicenseParameters
userIDUser or instance id for license registration, it can be anything - email, host or domain name, handle, etc.
Return Value
Shared pointer to License if registration succeeded, throws exceptions in case of errors.
-
Unregister client with given id.
Throws
LSErrorif unregistration fails.Declaration
Swift
@objc func unregister(userID: String) throws -
Remove license file and internal SDK files if any of them exist.
Note
Typically should be called after license deactivation in the app uninstaller.Throws
Error if clearing fails.Declaration
Swift
@objc func clearLocalStorage() throws -
Helper method to check connection to the Floating server.
Declaration
Swift
@objc func checkConnection() -> BoolReturn Value
trueif SDK is able to connect to the Floating server andfalseotherwise. -
Authenticates a user on Floating Server V2 and caches the JWT token.
Use this before performing any other Floating Server V2 operations. This method only works with Floating Server V2 and will throw if used against a non-V2 server.
Throws
LSErrorif input is invalid or authentication fails.Declaration
Swift
@objc func authenticateUser(user: String, password: String) throwsParameters
userThe username of the Floating Server V2 account.
passwordThe corresponding password for authentication.
-
Registers a floating license on Floating Server V2.
The server assigns the client a floating session associated with a specific license ID and optional user (client) ID.
Throws
LSErrorif the input is invalid or registration fails.Declaration
Swift
func register(userID: String? = nil, licenseId: LicenseIDObjc) throws -> LicenseParameters
userIDA client ID to associate with the floating license. If omitted, falls back to
currentLicense.floatingClientId.licenseIdThe license to register for Floating Server V2.
Return Value
The updated
Licenseobject returned by the server. -
Retrieves floating license information from Floating Server V2.
Throws
LSErrorif retrieval or JSON parsing fails.Declaration
Swift
@objc func getLicenseInfo(licenseId: LicenseIDObjc? = nil) throws -> LicenseParameters
licenseIdOptional license identifier to query. If omitted, all information for the current license is returned.
Return Value
A fully constructed
Licenseinstance populated from server data. -
Retrieves all active floating license IDs from Floating Server V2.
Throws
LSErrorif the request fails.Declaration
Swift
@objc func getAllLicenses() throws -> [LicenseIDObjc]Return Value
An array of active
LicenseIDObjcvalues available to the user. -
Borrows a floating license until a specific expiration date.
This locks the license for the given user until at least the provided date. The server may return a later time depending on its rules.
Throws
LSErrorif the request fails or input is invalid.Declaration
Swift
@objc func borrow(userID: String, licenseId: LicenseIDObjc, until date: Date) throws -> StringParameters
userIDThe floating client ID associated with the borrowing user.
licenseIdThe license ID to borrow.
Return Value
A string representing the actual borrow expiration time returned by the server.
-
Undocumented
Declaration
Swift
@objc func getToken() throws -> JwtToken -
Undocumented
Declaration
Swift
@objc func saveToFile() throws